package world.liquor.dao;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.ibatis.SqlMapClientTemplate;
import org.springframework.stereotype.Repository;

import world.liquor.domain.BeerInfo;

@Repository
public class myBeerDAOImpl implements myBeerDAO {
	
	@Autowired
	private SqlMapClientTemplate sqlMap;

	public myBeerDAOImpl(SqlMapClientTemplate sqlMap) {
		this.sqlMap = sqlMap;
	}

	public myBeerDAOImpl() {
	}

	//property 를 통해 주입
	public void setSqlMap(SqlMapClientTemplate sqlMap) {
		this.sqlMap = sqlMap;
	}

	@Override
	public ArrayList<BeerInfo> selectBeerByIdNotAssessment(String memberId) throws SQLException {
		HashMap map = new HashMap();
		map.put("memberId", memberId);
		map.put("assessment", 0);
		return (ArrayList<BeerInfo>) sqlMap.queryForList("selectBeerByIdNotAssessment",  map);
	}

	@Override
	public ArrayList<BeerInfo> selectBeerByIdAssessment(String memberId) throws SQLException {
		HashMap map = new HashMap();
		map.put("memberId", memberId);
		map.put("assessment", 0);
		return (ArrayList<BeerInfo>) sqlMap.queryForList("selectBeerByIdAssessment",  map);
	}

	
	



}
